import { defineComponent, ref, PropType } from 'vue';
import { Button } from 'ant-design-vue';
interface DelayLoading {
  delay: number;
}
export default defineComponent({
  name: 'exportDate',
  props: {
    hrefUrl: {
      type: String,
      default: ''
    }
  },
  setup(props) {
    const loading = ref<boolean | DelayLoading>(false);
    const delay: number = 3000;

    return () => (
      <Button
        onClick={() => {
          // location.href = props.hrefUrl;
          // window.open(props.hrefUrl, '_blank, download')
          // console.log('props.hrefUrl', props.hrefUrl)
          loading.value = true;
          setTimeout(() => {
            loading.value = false;
          }, 3000);
        }}
        type="primary"
        loading={loading.value}
      >
        <a class={'text-white hover:text-white'} download href={props.hrefUrl}>
          导出数据
        </a>
      </Button>
    );
  }
});
